﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CompanyCMS.Masters
{
    public partial class Admin : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["user"] == null)
                {
                    if (!Request.Url.ToString().Contains("login.aspx"))
                    {
                        Response.Redirect("~/admin/login.aspx");
                    }
                    else
                    {
                        ph.Visible = false;
                    }
                }
                else
                {
                    lbluser.Text = Session["user"].ToString();
                }
            }
        }

        protected void btnLogout_Click(object sender, EventArgs e)
        {
            Session["user"] = null;
            Response.Redirect("~/admin/login.aspx");
        }
    }
}